import time
from unittest import TestCase
from selenium import webdriver
from selenium.webdriver.common.by import By

class testBuy(TestCase):
    def testBuy1(self):
        username='lisi'
        password='123456'
        expect1='买入成功!'
        expect2='账户余额：999900.00元'
        pay_password='666666'
        driver=webdriver.Chrome()
        driver.get('http://localhost:90')
        driver.maximize_window()
        driver.implicitly_wait(15)
        driver.find_element(By.ID,'username').send_keys(username)
        driver.find_element(By.ID,'password').send_keys(password)
        driver.find_element(By.XPATH,'//*[@id="login_btn"]').click()
        time.sleep(3)
        driver.find_element(By.XPATH,'//*[@id="leftbaraside"]/div[2]/nav/ul/li[2]/a').click()
        driver.find_element(By.XPATH,'//*[@id="leftbaraside"]/div[2]/nav/ul/li[2]/ul/li[1]/a').click()
        driver.find_element(By.XPATH,'/html/body/div/div/main/div/div/div/div/div[2]/div/table/tbody/tr[1]/td[6]/button').click()
        time.sleep(3)
        driver.find_element(By.CSS_SELECTOR, ".layui-layer-content > #password").send_keys(pay_password)
        time.sleep(3)
        driver.find_element(By.XPATH,'//*[@id="layui-layer1"]/div[3]/a[1]').click()
        time.sleep(3)
        result=driver.find_element(By.XPATH,'/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[3]/div/div').text
        driver.find_element(By.XPATH,'/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[4]/button').click()
        time.sleep(2)
        driver.find_element(By.XPATH,'//*[@id="leftbaraside"]/div[2]/nav/ul/li[4]/a').click()
        time.sleep(1)
        driver.find_element(By.XPATH,'/html/body/div/div/aside/div[2]/nav/ul/li[4]/ul/li[3]/a').click()
        time.sleep(3)
        result2=driver.find_element(By.XPATH,'/html/body/div/div/main/div/div/div[2]/div/div/div[2]/h4[2]').text
        if expect1!=result:
            driver.save_screenshot('买入成功.png')
        if expect2!=result2:
            driver.save_screenshot('999900.png')
        self.assertEqual(expect1,result)
        self.assertEqual(expect2,result2)
        driver.quit()

    def testBuy2(self):
        username='lisi'
        password='123456'
        pay_password='1234567'
        expect='买入失败!'
        expect2='账户余额：1000000.00元'
        driver=webdriver.Chrome()
        driver.get("http://localhost:90")
        driver.maximize_window()
        driver.implicitly_wait(15)
        driver.find_element(By.ID, 'username').send_keys(username)
        driver.find_element(By.ID, 'password').send_keys(password)
        driver.find_element(By.XPATH, '//*[@id="login_btn"]').click()
        time.sleep(3)
        driver.find_element(By.XPATH,'//*[@id="leftbaraside"]/div[2]/nav/ul/li[2]/a').click()
        driver.find_element(By.XPATH,'//*[@id="leftbaraside"]/div[2]/nav/ul/li[2]/ul/li[1]/a').click()
        driver.find_element(By.XPATH,'/html/body/div/div/main/div/div/div/div/div[2]/div/table/tbody/tr[1]/td[6]/button').click()
        time.sleep(3)
        driver.find_element(By.CSS_SELECTOR, ".layui-layer-content > #password").send_keys(pay_password)
        driver.find_element(By.LINK_TEXT,'确定').click()
        result = driver.find_element(By.XPATH,'/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[3]/div/div').text
        driver.find_element(By.XPATH,'/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[4]/button').click()
        driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/a').click()
        time.sleep(1)
        driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/ul/li[3]/a').click()
        time.sleep(3)
        result2 = driver.find_element(By.XPATH, '/html/body/div/div/main/div/div/div[2]/div/div/div[2]/h4[2]').text
        if result!=expect:
            driver.save_screenshot('买入失败.png')
        if result2!=expect2:
            driver.save_screenshot('1000000.png')
        self.assertEqual(expect,result)
        self.assertEqual(expect2,result2)
        driver.close()

    def testBuy3(self):
        username='lisi4'
        password='123456'
        pay_password='666666'
        expect='买入失败!，银行卡余额不足'
        expect1='账户余额：50.00元'
        driver=webdriver.Chrome()
        driver.maximize_window()
        driver.get("http://localhost:90")
        driver.implicitly_wait(15)
        driver.find_element(By.ID, 'username').send_keys(username)
        driver.find_element(By.ID, 'password').send_keys(password)
        driver.find_element(By.XPATH, '//*[@id="login_btn"]').click()
        time.sleep(3)
        driver.find_element(By.XPATH, '//*[@id="leftbaraside"]/div[2]/nav/ul/li[2]/a').click()
        driver.find_element(By.XPATH, '//*[@id="leftbaraside"]/div[2]/nav/ul/li[2]/ul/li[1]/a').click()
        driver.find_element(By.XPATH,'/html/body/div/div/main/div/div/div/div/div[2]/div/table/tbody/tr[1]/td[6]/button').click()
        time.sleep(3)
        driver.find_element(By.CSS_SELECTOR, ".layui-layer-content > #password").send_keys(pay_password)
        driver.find_element(By.LINK_TEXT, '确定').click()
        result=driver.find_element(By.XPATH,'/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[3]/div/div').text
        driver.find_element(By.XPATH,'/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[4]/button').click()
        driver.find_element(By.XPATH, '/html/body/div[1]/div/aside/div[2]/nav/ul/li[4]/a').click()
        time.sleep(1)
        driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/ul/li[3]/a').click()
        time.sleep(3)
        result2 = driver.find_element(By.XPATH, '/html/body/div/div/main/div/div/div[2]/div/div/div[2]/h4[2]').text
        if result!=expect:
            driver.save_screenshot('买入失败.png')
        if result2!=expect1:
            driver.save_screenshot('余额不变.png')
        self.assertEqual(expect,result)
        self.assertEqual(expect1,result2)
        driver.quit()
    def testBuy4(self):
        username='lisi5'
        password='123456'
        pay_password='666666'
        expect='买入失败!，请绑定银行卡'
        driver=webdriver.Chrome()
        driver.get("http://localhost:90")
        driver.maximize_window()
        driver.implicitly_wait(15)
        driver.find_element(By.ID, 'username').send_keys(username)
        driver.find_element(By.ID, 'password').send_keys(password)
        driver.find_element(By.XPATH, '//*[@id="login_btn"]').click()
        time.sleep(3)
        driver.find_element(By.XPATH, '//*[@id="leftbaraside"]/div[2]/nav/ul/li[2]/a').click()
        driver.find_element(By.XPATH, '//*[@id="leftbaraside"]/div[2]/nav/ul/li[2]/ul/li[1]/a').click()
        driver.find_element(By.XPATH,'/html/body/div/div/main/div/div/div/div/div[2]/div/table/tbody/tr[1]/td[6]/button').click()
        time.sleep(3)
        driver.find_element(By.CSS_SELECTOR, ".layui-layer-content > #password").send_keys(pay_password)
        driver.find_element(By.LINK_TEXT, '确定').click()
        result = driver.find_element(By.XPATH,'/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[3]/div/div').text
        if result!=expect:
            driver.save_screenshot('绑定银行卡.png')
        self.assertEqual(expect,result)
        driver.close()

    def testBuy5(self):
        username='lisi'
        password='123456'
        pay_password='666666'
        expect='账户余额：990000.00元'
        expect2='买入成功!'
        driver = webdriver.Chrome()
        driver.get("http://localhost:90")
        driver.maximize_window()
        driver.find_element(By.ID, 'username').send_keys(username)
        driver.find_element(By.ID, 'password').send_keys(password)
        driver.find_element(By.XPATH, '//*[@id="login_btn"]').click()
        time.sleep(3)
        driver.find_element(By.XPATH, '/html/body/div[1]/div/aside/div[2]/nav/ul/li[2]/a').click()
        time.sleep(2)
        driver.find_element(By.XPATH,'/html/body/div[1]/div/aside/div[2]/nav/ul/li[2]/ul/li[2]/a').click()
        time.sleep(2)
        driver.find_element(By.XPATH,'/html/body/div/div/main/div/div/div/div/div[2]/div/table/tbody/tr[1]/td[8]/button').click()
        time.sleep(2)
        driver.find_element(By.CSS_SELECTOR,'.layui-layer-content > #password').send_keys(pay_password)
        time.sleep(2)
        driver.find_element(By.LINK_TEXT,'确定').click()
        time.sleep(2)
        result=driver.find_element(By.XPATH,'/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[3]/div/div').text
        time.sleep(2)
        driver.find_element(By.XPATH,'/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[4]/button').click()
        time.sleep(2)
        driver.find_element(By.XPATH,'/html/body/div/div/aside/div[2]/nav/ul/li[4]/a').click()
        time.sleep(2)
        driver.find_element(By.XPATH,'/html/body/div/div/aside/div[2]/nav/ul/li[4]/ul/li[3]/a').click()
        time.sleep(2)
        result2=driver.find_element(By.XPATH,'/html/body/div/div/main/div/div/div[2]/div/div/div[2]/h4[2]').text
        if result!=expect2:
            driver.save_screenshot('买入失败.png')
        if result2!=expect:
            driver.save_screenshot('999900.png')
        self.assertEqual(expect,result2)
        self.assertEqual(expect2,result)
        driver.close()
    def testBuy6(self):
        username = 'lisi'
        password = '123456'
        w_password = '666667'
        expect = '账户余额：990000.00元'
        expect2 = '买入失败!'
        driver = webdriver.Chrome()
        driver.get("http://localhost:90")
        driver.maximize_window()
        driver.find_element(By.ID, 'username').send_keys(username)
        driver.find_element(By.ID, 'password').send_keys(password)
        driver.find_element(By.XPATH, '//*[@id="login_btn"]').click()
        time.sleep(3)
        driver.find_element(By.XPATH, '/html/body/div[1]/div/aside/div[2]/nav/ul/li[2]/a').click()
        time.sleep(2)
        driver.find_element(By.XPATH, '/html/body/div[1]/div/aside/div[2]/nav/ul/li[2]/ul/li[2]/a').click()
        time.sleep(2)
        driver.find_element(By.XPATH,'/html/body/div/div/main/div/div/div/div/div[2]/div/table/tbody/tr[1]/td[8]/button').click()
        time.sleep(2)
        driver.find_element(By.CSS_SELECTOR, '.layui-layer-content > #password').send_keys(w_password)
        time.sleep(2)
        driver.find_element(By.LINK_TEXT, '确定').click()
        time.sleep(2)
        result = driver.find_element(By.XPATH,'/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[3]/div/div').text
        time.sleep(2)
        driver.find_element(By.XPATH, '/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[4]/button').click()
        time.sleep(2)
        driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/a').click()
        time.sleep(2)
        driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/ul/li[3]/a').click()
        time.sleep(2)
        result2 = driver.find_element(By.XPATH, '/html/body/div/div/main/div/div/div[2]/div/div/div[2]/h4[2]').text
        if result != expect2:
            driver.save_screenshot('买入失败.png')
        if result2 != expect:
            driver.save_screenshot('999900.png')
        self.assertEqual(expect, result2)
        self.assertEqual(expect2, result)
        driver.close()
    def testBuy7(self):
        username = 'lisi4'
        password = '123456'
        pay_password = '666666'
        expect2 = '买入失败!，银行卡余额不足'
        expect = '账户余额：50.00元'
        driver = webdriver.Chrome()
        driver.get("http://localhost:90")
        driver.maximize_window()
        driver.find_element(By.ID, 'username').send_keys(username)
        driver.find_element(By.ID, 'password').send_keys(password)
        driver.find_element(By.XPATH, '//*[@id="login_btn"]').click()
        time.sleep(3)
        driver.find_element(By.XPATH, '/html/body/div[1]/div/aside/div[2]/nav/ul/li[2]/a').click()
        time.sleep(2)
        driver.find_element(By.XPATH, '/html/body/div[1]/div/aside/div[2]/nav/ul/li[2]/ul/li[2]/a').click()
        time.sleep(2)
        driver.find_element(By.XPATH,'/html/body/div/div/main/div/div/div/div/div[2]/div/table/tbody/tr[1]/td[8]/button').click()
        time.sleep(2)
        driver.find_element(By.CSS_SELECTOR, '.layui-layer-content > #password').send_keys(pay_password)
        time.sleep(2)
        driver.find_element(By.LINK_TEXT, '确定').click()
        time.sleep(2)
        result = driver.find_element(By.XPATH, '/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[3]/div/div').text
        time.sleep(2)
        driver.find_element(By.XPATH, '/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[4]/button').click()
        time.sleep(2)
        driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/a').click()
        time.sleep(2)
        driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/ul/li[3]/a').click()
        time.sleep(2)
        result2 = driver.find_element(By.XPATH, '/html/body/div/div/main/div/div/div[2]/div/div/div[2]/h4[2]').text
        if result != expect:
            driver.save_screenshot('买入失败.png')
        if result2 != expect2:
            driver.save_screenshot('999900.png')
        self.assertEqual(expect, result2)
        self.assertEqual(expect2, result)
        driver.close()

    def testBuy8(self):
        username = 'lisi5'
        password = '123456'
        pay_password = '666666'
        expect = '买入失败!，请绑定银行卡'
        driver = webdriver.Chrome()
        driver.get("http://localhost:90")
        driver.maximize_window()
        driver.find_element(By.ID, 'username').send_keys(username)
        driver.find_element(By.ID, 'password').send_keys(password)
        driver.find_element(By.XPATH, '//*[@id="login_btn"]').click()
        time.sleep(3)
        driver.find_element(By.XPATH, '/html/body/div[1]/div/aside/div[2]/nav/ul/li[2]/a').click()
        time.sleep(2)
        driver.find_element(By.XPATH, '/html/body/div[1]/div/aside/div[2]/nav/ul/li[2]/ul/li[2]/a').click()
        time.sleep(2)
        driver.find_element(By.XPATH, '/html/body/div/div/main/div/div/div/div/div[2]/div/table/tbody/tr[1]/td[8]/button').click()
        time.sleep(2)
        driver.find_element(By.CSS_SELECTOR, '.layui-layer-content > #password').send_keys(pay_password)
        time.sleep(2)
        driver.find_element(By.LINK_TEXT, '确定').click()
        time.sleep(2)
        result = driver.find_element(By.XPATH,'/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[3]/div/div').text
        time.sleep(2)
        driver.find_element(By.XPATH, '/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[4]/button').click()
        time.sleep(2)
        driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/a').click()
        time.sleep(2)
        driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/ul/li[3]/a').click()
        time.sleep(2)
        if result != expect:
            driver.save_screenshot('买入失败.png')
        self.assertEqual(expect, result)
        driver.close()

    def testBuy9(self):
        username = 'lisi'
        password = '123456'
        pay_password = '666666'
        expect = '买入成功!'
        expect2='账户余额：997000.00元'
        driver = webdriver.Chrome()
        driver.get("http://localhost:90")
        driver.maximize_window()
        driver.find_element(By.ID, 'username').send_keys(username)
        driver.find_element(By.ID, 'password').send_keys(password)
        driver.find_element(By.XPATH, '//*[@id="login_btn"]').click()
        time.sleep(3)
        driver.find_element(By.XPATH, '/html/body/div[1]/div/aside/div[2]/nav/ul/li[2]/a').click()
        time.sleep(2)
        driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[2]/ul/li[3]/a').click()
        time.sleep(2)
        driver.find_element(By.XPATH,'/html/body/div/div/main/div/div/div/div/div[2]/div/table/tbody/tr[1]/td[9]/button').click()
        time.sleep(2)
        driver.find_element(By.CSS_SELECTOR, '.layui-layer-content > #password').send_keys(pay_password)
        time.sleep(2)
        driver.find_element(By.LINK_TEXT, '确定').click()
        time.sleep(2)
        result = driver.find_element(By.XPATH,'/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[3]/div/div').text
        time.sleep(2)
        driver.find_element(By.XPATH, '/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[4]/button').click()
        time.sleep(2)
        driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/a').click()
        time.sleep(2)
        driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/ul/li[3]/a').click()
        time.sleep(2)
        result2=driver.find_element(By.XPATH,'/html/body/div/div/main/div/div/div[2]/div/div/div[2]/h4[2]').text
        if result != expect:
            driver.save_screenshot('买入失败.png')
        if result2!=expect2:
            driver.save_screenshot('999900.png')
        self.assertEqual(expect, result)
        self.assertEqual(expect2,result2)
        driver.close()
    def testBuy10(self):
        username = 'lisi'
        password = '123456'
        pay_password = '666667'
        expect = '买入失败!'
        expect2 = '账户余额：997000.00元'
        driver = webdriver.Chrome()
        driver.get("http://localhost:90")
        driver.maximize_window()
        driver.find_element(By.ID, 'username').send_keys(username)
        driver.find_element(By.ID, 'password').send_keys(password)
        driver.find_element(By.XPATH, '//*[@id="login_btn"]').click()
        time.sleep(3)
        driver.find_element(By.XPATH, '/html/body/div[1]/div/aside/div[2]/nav/ul/li[2]/a').click()
        time.sleep(2)
        driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[2]/ul/li[3]/a').click()
        time.sleep(2)
        driver.find_element(By.XPATH,'/html/body/div/div/main/div/div/div/div/div[2]/div/table/tbody/tr[1]/td[9]/button').click()
        time.sleep(2)
        driver.find_element(By.CSS_SELECTOR, '.layui-layer-content > #password').send_keys(pay_password)
        time.sleep(2)
        driver.find_element(By.LINK_TEXT, '确定').click()
        time.sleep(2)
        result = driver.find_element(By.XPATH,'/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[3]/div/div').text
        time.sleep(2)
        driver.find_element(By.XPATH, '/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[4]/button').click()
        time.sleep(2)
        driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/a').click()
        time.sleep(2)
        driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/ul/li[3]/a').click()
        time.sleep(2)
        result2 = driver.find_element(By.XPATH, '/html/body/div/div/main/div/div/div[2]/div/div/div[2]/h4[2]').text
        if result != expect:
            driver.save_screenshot('买入失败.png')
        if result2 != expect2:
            driver.save_screenshot('999900.png')
        self.assertEqual(expect, result)
        self.assertEqual(expect2, result2)
        driver.close()

    def testBuy11(self):
        username = 'lisi4'
        password = '123456'
        pay_password = '666666'
        expect = '买入失败!，银行卡余额不足'
        expect2 = '账户余额：50.00元'
        driver = webdriver.Chrome()
        driver.get("http://localhost:90")
        driver.maximize_window()
        driver.find_element(By.ID, 'username').send_keys(username)
        driver.find_element(By.ID, 'password').send_keys(password)
        driver.find_element(By.XPATH, '//*[@id="login_btn"]').click()
        time.sleep(3)
        driver.find_element(By.XPATH, '/html/body/div[1]/div/aside/div[2]/nav/ul/li[2]/a').click()
        time.sleep(2)
        driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[2]/ul/li[3]/a').click()
        time.sleep(2)
        driver.find_element(By.XPATH,'/html/body/div/div/main/div/div/div/div/div[2]/div/table/tbody/tr[1]/td[9]/button').click()
        time.sleep(2)
        driver.find_element(By.CSS_SELECTOR, '.layui-layer-content > #password').send_keys(pay_password)
        time.sleep(2)
        driver.find_element(By.LINK_TEXT, '确定').click()
        time.sleep(2)
        result = driver.find_element(By.XPATH,'/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[3]/div/div').text
        time.sleep(2)
        driver.find_element(By.XPATH, '/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[4]/button').click()
        time.sleep(2)
        driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/a').click()
        time.sleep(2)
        driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/ul/li[3]/a').click()
        time.sleep(2)
        result2 = driver.find_element(By.XPATH, '/html/body/div/div/main/div/div/div[2]/div/div/div[2]/h4[2]').text
        if result != expect:
            driver.save_screenshot('买入失败.png')
        if result2 != expect2:
            driver.save_screenshot('999900.png')
        self.assertEqual(expect, result)
        self.assertEqual(expect2, result2)
        driver.close()
    def testBuy12(self):
        username = 'lisi5'
        password = '123456'
        pay_password = '666666'
        expect = '买入失败!，请绑定银行卡'
        driver = webdriver.Chrome()
        driver.get("http://localhost:90")
        driver.maximize_window()
        driver.find_element(By.ID, 'username').send_keys(username)
        driver.find_element(By.ID, 'password').send_keys(password)
        driver.find_element(By.XPATH, '//*[@id="login_btn"]').click()
        time.sleep(3)
        driver.find_element(By.XPATH, '/html/body/div[1]/div/aside/div[2]/nav/ul/li[2]/a').click()
        time.sleep(2)
        driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[2]/ul/li[3]/a').click()
        time.sleep(2)
        driver.find_element(By.XPATH,'/html/body/div/div/main/div/div/div/div/div[2]/div/table/tbody/tr[1]/td[9]/button').click()
        time.sleep(2)
        driver.find_element(By.CSS_SELECTOR, '.layui-layer-content > #password').send_keys(pay_password)
        time.sleep(2)
        driver.find_element(By.LINK_TEXT, '确定').click()
        time.sleep(2)
        result = driver.find_element(By.XPATH,'/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[3]/div/div').text
        time.sleep(2)
        driver.find_element(By.XPATH, '/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[4]/button').click()
        time.sleep(2)
        driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/a').click()
        time.sleep(2)
        driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/ul/li[3]/a').click()
        time.sleep(2)
        if result != expect:
            driver.save_screenshot('买入失败.png')
        self.assertEqual(expect, result)
        driver.close()

    def testBuy13(self):
        username = 'lisi6'
        password = '123456'
        pay_password = '666667'
        expect = '买入失败!,请前往个人信息设置支付密码'
        driver = webdriver.Chrome()
        driver.get("http://localhost:90")
        driver.maximize_window()
        driver.find_element(By.ID, 'username').send_keys(username)
        driver.find_element(By.ID, 'password').send_keys(password)
        driver.find_element(By.XPATH, '//*[@id="login_btn"]').click()
        time.sleep(3)
        driver.find_element(By.XPATH, '/html/body/div[1]/div/aside/div[2]/nav/ul/li[2]/a').click()
        time.sleep(2)
        driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[2]/ul/li[3]/a').click()
        time.sleep(2)
        driver.find_element(By.XPATH,'/html/body/div/div/main/div/div/div/div/div[2]/div/table/tbody/tr[1]/td[9]/button').click()
        time.sleep(2)
        driver.find_element(By.CSS_SELECTOR, '.layui-layer-content > #password').send_keys(pay_password)
        time.sleep(2)
        driver.find_element(By.LINK_TEXT, '确定').click()
        time.sleep(2)
        result = driver.find_element(By.XPATH,'/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[3]/div/div').text
        time.sleep(2)
        driver.find_element(By.XPATH, '/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[4]/button').click()
        time.sleep(2)
        driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/a').click()
        time.sleep(2)
        driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/ul/li[3]/a').click()
        time.sleep(2)
        if result != expect:
            driver.save_screenshot('买入失败.png')
        self.assertEqual(expect, result)
        driver.close()
    def testBuy14(self):
        username = 'lisi6'
        password = '123456'
        pay_password = '666666'
        expect = '买入成功!'
        expect2='账户余额：1000.00元'
        driver = webdriver.Chrome()
        driver.get("http://localhost:90")
        driver.maximize_window()
        driver.find_element(By.ID, 'username').send_keys(username)
        driver.find_element(By.ID, 'password').send_keys(password)
        driver.find_element(By.XPATH, '//*[@id="login_btn"]').click()
        time.sleep(3)
        driver.find_element(By.XPATH, '/html/body/div[1]/div/aside/div[2]/nav/ul/li[2]/a').click()
        time.sleep(2)
        driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[2]/ul/li[3]/a').click()
        time.sleep(2)
        driver.find_element(By.XPATH,'/html/body/div/div/main/div/div/div/div/div[2]/div/table/tbody/tr[1]/td[9]/button').click()
        time.sleep(2)
        driver.find_element(By.CSS_SELECTOR, '.layui-layer-content > #password').send_keys(pay_password)
        time.sleep(2)
        driver.find_element(By.LINK_TEXT, '确定').click()
        time.sleep(2)
        result = driver.find_element(By.XPATH,'/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[3]/div/div').text
        time.sleep(2)
        driver.find_element(By.XPATH,'/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[4]/button').click()
        time.sleep(2)
        driver.find_element(By.XPATH,'/html/body/div/div/aside/div[2]/nav/ul/li[4]/a').click()
        time.sleep(2)
        driver.find_element(By.XPATH,'/html/body/div/div/aside/div[2]/nav/ul/li[4]/ul/li[3]/a').click()
        time.sleep(2)
        result2 = driver.find_element(By.XPATH, '/html/body/div/div/main/div/div/div[3]/div/div/div[2]/h4[2]').text
        if result != expect:
            driver.save_screenshot('买入失败.png')
        if result2!=expect2:
            driver.save_screenshot('7000.png')
        self.assertEqual(expect, result)
        self.assertEqual(expect2,result2)
        driver.close()
    def testBuy15(self):
        username = 'lisi5'
        password = '123456'
        pay_password = '666666'
        expect = '买入失败!，请绑定银行卡'
        driver = webdriver.Chrome()
        driver.get("http://localhost:90")
        driver.maximize_window()
        driver.find_element(By.ID, 'username').send_keys(username)
        driver.find_element(By.ID, 'password').send_keys(password)
        driver.find_element(By.XPATH, '//*[@id="login_btn"]').click()
        time.sleep(3)
        driver.find_element(By.XPATH, '/html/body/div[1]/div/aside/div[2]/nav/ul/li[2]/a').click()
        time.sleep(2)
        driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[2]/ul/li[3]/a').click()
        time.sleep(2)
        driver.find_element(By.XPATH,'/html/body/div/div/main/div/div/div/div/div[2]/div/table/tbody/tr[1]/td[9]/button').click()
        time.sleep(2)
        driver.find_element(By.CSS_SELECTOR, '.layui-layer-content > #password').send_keys(pay_password)
        time.sleep(2)
        driver.find_element(By.LINK_TEXT, '确定').click()
        time.sleep(2)
        result = driver.find_element(By.XPATH,'/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[3]/div/div').text
        time.sleep(2)
        driver.find_element(By.XPATH, '/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[4]/button').click()
        time.sleep(2)
        driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/a').click()
        time.sleep(2)
        driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/ul/li[3]/a').click()
        time.sleep(2)
        if result != expect:
            driver.save_screenshot('买入失败.png')
        self.assertEqual(expect, result)
        driver.close()